import numpy as np 
import matplotlib.pyplot as plt

t = np.arange(0,16000)

freq = np.array([1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000])

freq = np.array([15000,2500, 3500, 4500, 5500, 6500, 7500])

sig1 = np.zeros((1600, ), dtype=np.single)
freq = np.array([1000, 2000, 3000, 4000, 5000, 6000, 7000])
for i, v in enumerate(freq):
    print(i,v)
    sig1 = sig1 + 0.1*np.sin(2*np.pi*v*np.arange(0,1600)/16000.0)

sig2 = np.zeros((1600, ), dtype=np.single)
freq = np.array([1500,2500, 3500, 4500, 5500, 6500, 7500])
for i, v in enumerate(freq):
    print(i,v)
    sig2 = sig2 + 0.1*np.sin(2*np.pi*v*np.arange(0,1600)/16000.0)

sig3 = np.zeros((1600, ), dtype=np.single)
freq = np.array([1000, 2000, 3000, 4000, 5000, 6000, 7000])
for i, v in enumerate(freq):
    print(i,v)
    sig3 = sig3 + 0.1*np.sin(2*np.pi*v*np.arange(0,1600)/16000.0)

sig4 = np.zeros((1600, ), dtype=np.single)
freq = np.array([1500,2500, 3500, 4500, 5500, 6500, 7500])
for i, v in enumerate(freq):
    print(i,v)
    sig4 = sig4 + 0.1*np.sin(2*np.pi*v*np.arange(0,1600)/16000.0)

x0 = np.zeros((16*10, ), dtype=np.single)

sig = np.hstack((sig1, x0, sig2, x0, sig3, x0, sig4, x0, sig1, x0, sig2, x0, sig3, x0, sig4))

plt.figure()
plt.plot(sig)
plt.show()



with open("signal.pcm", "wb") as fid:
    fid.write((sig*32767).astype(np.short).tobytes())





